/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package testadventure;


import edu.clemson.cs.hamptos.adventure.AdventureCommand;
import edu.clemson.cs.hamptos.adventure.AdventureEngine;
import edu.clemson.cs.hamptos.adventure.AdventureTarget;
import edu.clemson.cs.hamptos.adventure.AdventureWindow;
import edu.clemson.cs.hamptos.adventure.VerbStrategyAlt;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Set;

/**
 *<p>This class requires the player to use the password pieces collected during the 
 * game in order to open the elevator.</p>
 * 
 */
public class VerbEnterPassword implements VerbStrategyAlt {
    protected final HashSet<String> verbs = new HashSet<String>();
    /**
     * 
     */
    VerbEnterPassword()
    {
        verbs.add("enter");
        
    }
    /**
     * <p> this method checks to see if the password is required.  If the elevator
     * is open, you will not need it, otherwise you will have to enter the correct
     * password.</p>
     * @param c 
     * @param e
     * @param w 
     */

    @Override
    public void doCommand(AdventureCommand c, AdventureEngine e, AdventureWindow w) {
        AdventureTarget thedo = c.getDirectObject();
        AdventureTarget theido = c.getIndirectObject();
        
        
        HashMap<String, Integer> dostats = thedo.getStats();
        HashMap<String, Integer> idostats = theido.getStats();
        
        //see if do is defeated or still active
        if (dostats.get("enabled") == 0)
        {
            w.println("elevatordoor is already open.");
            return;
        }
        
        w.println("You entered the correct password");
        
        
        dostats.put("enabled", 1);
        
        
    } 
        @Override
    public String getName() {
        return "VerbEnterPassword";
    }

    @Override
    public Set<String> getVerbs() {
        return new HashSet<String>(verbs);
    }
    
}
